<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/22 0022
 * Time: 14:25
 */

namespace app\wap\validate;


use think\Validate;

class Login extends Validate
{
    protected $rule = [
        'phone'         =>  'require|length:11|regex:/^1[345789]\d{9}$/',
        'repassword'    =>  'require|confirm:password',
        'password'      =>  'require|min:8|max:16|regex:/^[a-z0-9\#]*$/',
        'yzm'           =>  'require|length:4|integer',
        'reg_id'        =>  'require',
        'openid'        =>  'require'
    ];

    protected $message = [
        'password.max'      =>  '密码长度不能超过16位',
        'password.min'      =>  '密码不能小于8位',
        'password.regex'    =>  '请填写英文、数字或两种组合的密码',
        'password.require'  =>  '请填写密码',
        'phone.length'      =>  '请输入11位手机号',
        'phone.regex'       =>  '请输入正确的手机号码',
        'phone.require'     =>  '请输入手机号',
        'repassword.config' =>  '两次密码不相同',
        'repassword.require'=>  '两次密码不相同',
        'yzm.length'        =>  '请输入四位数验证码',
        'yzm.integer'       =>  '请输入数字验证码',
        'yzm.require'       =>  '请输入验证码',
        'reg_id.require'    =>  '请上传设备号',
        'openid.require'    =>  '请输入微信标识',
    ];

    protected $scene = [
        'register'  =>  ['phone','password','yzm'],
        'login'     =>  ['phone','password','reg_id'],
        'forget'    =>  ['password','repassword','yzm','phone'],
        'regyzm'    =>  ['phone'],
        'forgetyzm' =>  ['phone'],
        'wxlogin'   =>  ['reg_id','openid']
    ];


}